package com.hrt.common.systemmanager.systemsetting.dict.data;

import com.btcode.db.result.Row;
import com.btcode.web.core.annotation.RequestMapping;
import com.hrt.common.web.BaseController;
import com.hrt.common.web.RequestUnit;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

@RequestMapping(path = "/systemmanager/systemsetting/dict/data")
public class DictDataController extends BaseController {

    public DictDataController() {
        initModelClass(new BcDictDataModel());
        initServiceClass(DictDataService.class);
    }

    @RequestMapping(path = "list")
    public void list(ServletRequest arg0, ServletResponse arg1) throws IOException {
        String dictTypeCode = RequestUnit.getString("dictTypeCode");
        List<Row> list = getService(DictDataService.class).getList(dictTypeCode);
        success(list);
    }

    /**
     * 根据code获取字典子项
     */
    @RequestMapping(path = "get-dict-child-list")
    public void getDictChildList(ServletRequest arg0, ServletResponse arg1) throws IOException {
        List<Row> list = getService(DictDataService.class).getDictChildList(
            RequestUnit.getHashMapParmS());
        success(list);
    }
}
